package huawei;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 数字游戏
 */
public class Q84 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            String string1 = sc.nextLine();
            String[] strings = string1.split(" ");
            int N = Integer.parseInt(strings[0].trim());
            int target = Integer.parseInt(strings[1].trim());

            int yu = 0; // 余数

            boolean find = false;
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < N; i++) {
                yu = (yu + sc.nextInt()) % target;

                if (set.contains(yu)) {
                    find = true;
                }

                set.add(yu);
            }
            if (find) {
                System.out.println("1");
            } else {
                System.out.println("0");
            }
            sc.nextLine();
        }
    }
}
